/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package logic;

/**
 *
 * @author kotionokyurievna
 */
public class MetroCardPassLimit extends MetroCard{
    private CardPassLimit limit;
    private int passes;
    
    public MetroCardPassLimit( CardDataBase cardDb, CardPassLimit passLimit, CardType cardType){
        setPassChecker( new CountPassChecker( this, cardDb));
        passes = passLimit.getLimit();
        limit = passLimit;
        setType(cardType);
    }
    
    public CardPassLimit getLimit(){
        return limit;
    }
    
    public int getPasses(){
        return passes;
    }
    
    public boolean pass(){
        if ( passes > 0 ){
            passes -= 1;
            return true;
        }
        return false;
    }
}
